<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\SocialEnergyContent;
use Illuminate\Http\Request;

class SocialEnergyController extends Controller
{
    /**
     * 获取社交能量站内容
     */
    public function index(Request $request)
    {
        $query = SocialEnergyContent::where('is_active', true);

        // 按类型筛选
        if ($request->has('content_type')) {
            $query->where('content_type', $request->content_type);
        }

        $contents = $query->orderBy('created_at', 'desc')->paginate(20);

        return response()->json($contents);
    }
}